package com.vhall.component.dao.room;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vhall.component.entity.data.vo.SearchVideoReqVO;
import com.vhall.component.entity.data.vo.SelectedVideoReqVO;
import com.vhall.component.entity.record.vo.RoomRspVO;
import com.vhall.component.entity.room.entity.RoomsEntity;
import com.vhall.component.entity.room.vo.RoomAdminListReqVO;
import com.vhall.component.entity.room.vo.RoomAdminListRspSingleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author rui.zhou
 * @date 2021/4/20 14:23
 */
@Mapper
@Repository
public interface RoomMapper extends BaseMapper<RoomsEntity> {



//    /**
//     * 查询信息
//     *
//     * @param roomId    房间id
//     * @param accountId 账户id
//     * @return 房间对象
//     */
//    @Select("select * from rooms where room_id=#{roomId} and account_id=#{accountId}")
//    RoomsEntity getRoom(@Param("roomId") String roomId, @Param("accountId") Integer accountId);

    /**
     * 批量查询房间信息
     *
     * @param ilIdlist 房间id组
     * @return 房间对象列表
     */
    List<RoomRspVO> selectRoomList(List<Integer> ilIdlist);

    IPage<RoomAdminListRspSingleVO> selectAdminList(@Param("page") Page<RoomsEntity> page, @Param("vo") RoomAdminListReqVO vo);

    IPage<RoomAdminListRspSingleVO> selectAdminListFoDemand(@Param("page") Page<RoomsEntity> page, @Param("vo") RoomAdminListReqVO vo);

    Page<RoomsEntity> selectAnchorRoomList(@Param("page")Page<RoomsEntity> page,
                                            @Param("userCode")String userCode,
                                            @Param("playbackStatus")Integer playbackStatus,
                                            @Param("keywords")String keywords);


    /**
     * 直播审核列表
     */
    IPage<RoomAdminListRspSingleVO> selectExamineList(@Param("page") Page<RoomsEntity> page, @Param("vo") RoomAdminListReqVO vo);

    IPage<RoomAdminListRspSingleVO> selectExamineListVideo(@Param("page") Page<RoomsEntity> page, @Param("vo") RoomAdminListReqVO vo);

    /**
     * 查询房间数（admin）
     *
     * @param queryWrapper 查询条件
     * @return 房间数
     */
    @Select("select count(*) from rooms left join account on rooms.account_id = account.account_id ${ew.customSqlSegment}")
    Integer countRoomForAdmin(@Param(Constants.WRAPPER) Wrapper<Object> queryWrapper);


    IPage<RoomsEntity> selectPageList(@Param("page") Page page, @Param("vo") SelectedVideoReqVO vo);


    IPage<RoomsEntity> selectedVideoList(@Param("page") Page<RoomsEntity> page, @Param("reqVO") SelectedVideoReqVO reqVO
            , @Param("type") Integer guoXinAccountType, @Param("orgCode") String orgCode, @Param("phone") String phone,
                                         @Param("custId") String custId, @Param("fundId") String fundId,@Param("staff")  Integer staff);

    IPage<RoomsEntity> selectedVideoListForColumn(@Param("page") Page<RoomsEntity> page, @Param("reqVO") SelectedVideoReqVO reqVO, @Param("phone") String phone,
                                                  @Param("custId") String custId, @Param("fundId") String fundId, @Param("staff") Integer staff);

    List<RoomsEntity> searchVideoList(@Param("reqVO") SearchVideoReqVO reqVO
            , @Param("type") Integer guoXinAccountType
            , @Param("orgCode") String orgCode, @Param("phone") String phone,
                                      @Param("custId") String custId, @Param("fundId") String fundId,@Param("staff") Integer staff);

}
